all:
	make english
	sleep .1 ; cd en ; make
	mv forum en/lbsd.static/forum
	mv phpbb en/lbsd.static/phpbb
	cp en/lbsd.static/arts/logo_forum.png en/lbsd.static/forumlogo.png
	make esperanto
	sleep .1 ; cd eo ; make

esperanto:
	sh eo.sh && mkdir $$(cat lists/mkdir.txt | sed 's^%l^eo^g')
	while read file ;  do \
		. eo.sh ; \
		envsubst < "$$file" > "$$(echo $$file | sed 's/meta/md/' | sed 's^pages^eo/lbsd^')" ; \
		done < lists/md.txt
	cp swx/* eo/
	cp -r misc/arts eo/lbsd/artoj
	sleep .1 ; . eo.sh ; envsubst < misc/swx.conf.meta > eo/swx.conf
	sleep .1 ; . eo.sh ; envsubst < misc/Makefile.meta > eo/Makefile
	mv eo/lbsd/index.md eo/lbsd/indekso.md
	mv eo/lbsd/art.md eo/lbsd/arto.md

english:
	sh en.sh && mkdir $$(cat lists/mkdir.txt | sed 's^%l^en^g')
	while read file ;  do \
		. en.sh ; \
		envsubst < "$$file" > "$$(echo $$file | sed 's/meta/md/' | sed 's^pages^en/lbsd^')" ; \
		done < lists/md.txt
	cp swx/* en
	cp -r misc/arts en/lbsd/arts
	sleep .1 ; . en.sh ; envsubst < misc/swx.conf.meta > en/swx.conf
	sleep .1 ; . en.sh ; envsubst < misc/Makefile.meta > en/Makefile

clean:
	mv en/lbsd.static/forum ./forum
	mv en/lbsd.static/phpbb ./phpbb
	rm -rf en/ eo/
